package it.pride.primefacesShowcase.controller;

import it.pride.primefacesShowcase.model.User;
import it.pride.primefacesShowcase.service.UserService;
import java.util.ArrayList;
import java.util.List;

import org.primefaces.model.DualListModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

/**
 * Created by IntelliJ IDEA.
 * User: lbonacina
 * Date: 4-nov-2010
 * Time: 17.26.58
 */
@Controller
@Scope("session")
public class MainController {

    @Autowired
    private UserService userService ;
    
    private String selectValue ;

    private String inputString ;
    
    private List<User> users ;

    private DualListModel<String> cities;
    
    public String getTitle() {
    	
    	return "Title Here" ;
    }

    public void init() {

        //Cities
        List<String> citiesSource = new ArrayList<String>();
        List<String> citiesTarget = new ArrayList<String>();

        citiesSource.add("Istanbul");
        citiesSource.add("Ankara");
        citiesSource.add("Izmir");
        citiesSource.add("Antalya");
        citiesSource.add("Bursa");

        cities = new DualListModel<String>(citiesSource, citiesTarget);
        
        users = userService.findAll() ;
    }


    public String getSelectValue() {
        return selectValue;
    }

    public void setSelectValue(String selectValue) {
        this.selectValue = selectValue;
    }

    public DualListModel<String> getCities() {
        return cities;
    }

    public void setCities(DualListModel<String> cities) {
        this.cities = cities;
    }

    public String getInputString() {
        return inputString;
    }

    public void setInputString(String inputString) {
        this.inputString = inputString;
    }

    public List<User> getUsers() {
        return users;
    }

    public void setUsers(List<User> users) {
        this.users = users;
    }

}
